package com.tcd.customer.service.impl;

import com.tcd.customer.mapper.RecognizeeInfoMapper;
import com.tcd.pojo.Client.RecognizeeInfo;
import com.tcd.customer.service.RecognizeeInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class RecognizeeInfoServiceImpl implements RecognizeeInfoService {
    @Resource
    RecognizeeInfoMapper recognizeeInfoMapper;

    @Override
    public List<RecognizeeInfo> getAll() {
        return recognizeeInfoMapper.getAll();
    }

    @Override
    public List<RecognizeeInfo> query(String recognizeeName,String credentialsId) {
        return recognizeeInfoMapper.query(recognizeeName,credentialsId);
    }

    @Override
    public int addPolicyholdersInfo(RecognizeeInfo recognizeeInfo) {
        String hecker_time=null;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
        hecker_time=df.format(new Date());
        recognizeeInfo.setCreateTime(hecker_time);
        return recognizeeInfoMapper.addPolicyholdersInfo(recognizeeInfo);
    }

    @Override
    public int amendRow(RecognizeeInfo recognizeeInfo) {
        String hecker_time=null;
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
        hecker_time=df.format(new Date());
        recognizeeInfo.setUpdateTime(hecker_time);
        return recognizeeInfoMapper.amendRow(recognizeeInfo);
    }

    @Override
    public int deleteRow(int recognizeeId) {
        return recognizeeInfoMapper.deleteRow(recognizeeId);
    }
}
